/*!
 * 面板控件.
 * ecp.qzz.ui.design.text.js
 * 创建：QZZ
 * 日期：2014-03-01
 */
define(["qzz.dbase"], function() {
	
	var qzz = window.qzz;
	qzz.space("ui.design");
	/**
	 * 面板控件.
	 */
	qzz.ui.design.text = qzz.Class(qzz.ui.design.base, {
		/**
		 * 创建函数
		 */
	    _create:function() {
	    	this.base();
            this.className = "Text";
	    },
	    
	    _setText:function(value) {
	    	if(value != this.getOption().text) {
	    		this.getOption().text = value;
	    		this.refresh();
	    	}
	    },	
	    
	    getAttribute:function() {
	    	var attr = this.base();
	    	attr.push({"name":"text","value":this.getOption().text});	    	
	    	attr.push({"name":"fontFamily","value":this.getOption().fontFamily});
	    	attr.push({"name":"fontWeight","value":this.getOption().fontWeight || "normal"});
	    	attr.push({"name":"fontStyle","value":this.getOption().fontStyle || "normal"});
	    	attr.push({"name":"textDecoration","value":this.getOption().textDecoration || "none"});
	    	attr.push({"name":"textAlign","value":this.getOption().textAlign || "left"});
	    	attr.push({"name":"fontSize","value":this._getNumberValue(this.getOption().fontSize, 12)});
	    	attr.push({"name":"color","value":this.getOption().color || ""});
	    	return attr;
	    },
	    
	    refresh:function() {
	    	this.base();
	    	if(this.getOption().color != null && this.getOption().color != "") {
	    	    this.thisWindow.style.color = this.getOption().color;
	    	}
	    	if(this.getOption().backgroundColor != null && this.getOption().backgroundColor != "") {
	    	    this.thisWindow.style.backgroundColor = this.getOption().backgroundColor;
	    	}
	    	this._setHtml(this.thisWindow, this.getOption().text);
	    	this.thisWindow.style.lineHeight = parseInt(this.getOption().height * this.getOption().scale,10) + "px";
	    }
	});
	
	/**
	 * 文本控件.
	 */
	_bindRenderFunc("qzztext", qzz.ui.design.text);
	return qzz.ui.design.text;
});